﻿<%@ WebHandler Language="C#" Class="CreateNewsList" %>

using System;
using System.Web;
using System.IO;
using System.Text;
using System.Data;

public class CreateNewsList : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        string strFileName = "NewList";
        string oHtml=HtmlHelper.ReadModel("faq.html");
        strFileName =HttpContext.Current.Server.MapPath("/UI/") + strFileName;
        DB link = new DB();
        DataTable classtb = link.Get("select classid,classname from newsclass");
        oHtml = HtmlOperation.ReplaceClass(classtb, oHtml,"分类");

        DataTable tb=link.Get("select title,time from news");
        oHtml = HtmlOperation.ReplaceClass(tb, oHtml,"标题|时间");
        if(oHtml!=null) {
            HtmlHelper.writeHtml(strFileName+".html",oHtml);
        }
        context.Response.Write("创建完毕");
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}